$this->addOption( 'namespaces',
'Import only the pages from namespaces belonging to the list of ' .
'pipe-separated namespace names or namespace indexes', false, true );
+ $this->addOption( 'rootpage', 'Pages will be imported as subpages of the specified page',
+ false, true );
$this->addOption( 'dry-run', 'Parse dump without actually importing pages' );
$this->addOption( 'debug', 'Output extra verbose debug information' );
$this->addOption( 'uploads', 'Process file upload data if included (experimental)' );
if ( $this->hasOption( 'no-updates' ) ) {
$importer->setNoUpdates( true );
}
+ if ( $this->hasOption( 'rootpage' ) ) {
+ $statusRootPage = $importer->setTargetRootPage( $this->getOption( 'rootpage' ) );
+ if ( !$statusRootPage->isGood() ) {
+ // Die here so that it doesn't print "Done!"
+ $this->error( $statusRootPage->getMessage()->text(), 1 );
+ return false;
+ }
+ }
$importer->setPageCallback( array( &$this, 'reportPage' ) );
$this->importCallback = $importer->setRevisionCallback(
array( &$this, 'handleRevision' ) );